package com.profound.notes.main.slice.vm;

import com.profound.notes.mvvm.CompositeViewModel;
import com.profound.notes.mvvm.MutableLiveData;
import ohos.aafwk.ability.Ability;

/**
 * @author zjwujlei
 * @date 2021/4/24
 * @email zjwujlei@sina.com
 * @description
 */
public class MainPlaneViewModel extends CompositeViewModel {
    public static final int PLANE_NOTE = 0;
    public static final int PLANE_NOTE_OPERATE = 1;
    public static final int PLANE_NOTE_SEARCH = 2;
    public static final int PLANE_TODO = 3;
    public static final int PLANE_TODO_OPERATE = 4;
    public static final int PLANE_TODO_SEARCH = 5;

    public final MutableLiveData<Integer> selected = new MutableLiveData<Integer>(PLANE_NOTE);

    public MainPlaneViewModel(Ability ability) {
        super(ability);
    }

    /*---- action ----*/
    public void planeAction(int plane){
        selected.setValue(plane);
    }

    @Override
    public boolean vagueAction(String action, Object... params) {
        switch (action){
            case "planeAction":
                if(params.length == 1 && params[0] instanceof Integer){
                    planeAction((Integer) params[0]);
                    return true;
                }
                break;
            default:
                break;
        }


        return super.vagueAction(action, params);
    }
}
